home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d21
/
dvglue10.arc
/
UISIGNAL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-08-13
|
2KB
|
64 lines
/*======================================================*/
/* UISIGNAL.C */
/* */
/* (c) Copyright 1988 Ralf Brown. All Rights Reserved. */
/*======================================================*/
#include "tvapi.h"
#include "tvstream.h"
#include "tvui.h"
/*======================================================*/
static void (*signal_handlers[TV_MENU_END-TV_HMOVE+1])(NOTIFY_MSG far *) ;
/*======================================================*/
/*======================================================*/
static void far UIsignal_handler(void)
{
NOTIFY_MSG msg ;
PARMLIST2 p ;
register int count ;
while (TVmbx_size(NIL) > 0)
{
/* do what TVreadmail() does, but such that DS doesn't have to equal SS */
p.num_args = 0 ;
TVsendmsg(READ_MSG, MAILME, NIL, (PARMLIST *)&p) ;
count = (int) p.arg[1] ;
if (count > sizeof(msg))
count = sizeof(msg) ;
while (count-- > 0)
((char *)&msg)[count] = ((char far *)p.arg[0])[count] ;
msg.event -= MS_NOTIFY ;
if (msg.event >= TV_HMOVE && msg.event <= TV_MENU_END && signal_handlers[msg.event] != NULL)
(*signal_handlers[msg.event])((NOTIFY_MSG far *)&msg) ;
}
}
/*======================================================*/
/* UIsignal set up handlers for specified notify msgs */
/* Ralf Brown 8/1/88 */
/*======================================================*/
void (* pascal UIsignal(int signal,OBJECT window,void (*handler)(NOTIFY_MSG far *)))(NOTIFY_MSG far *)
{
void (*old_handler)(NOTIFY_MSG far *) ;
old_handler = signal_handlers[signal] ;
signal_handlers[signal] = handler ;
if (handler != NULL)
{
TVwin_async(window,UIsignal_handler) ; /* we may not have installed the */
/* handler on this window yet */
TVwin_notify(window,signal) ;
TVwin_allow(window,signal) ;
}
else
TVwin_cancel(window,signal) ;
return old_handler ;
}
/* End of UISIGNAL.C */